package com.empire.module.member.dal.mysql.cases;

import com.empire.framework.common.pojo.PageResult;
import com.empire.framework.mybatis.core.mapper.BaseMapperX;
import com.empire.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.empire.module.member.controller.admin.cases.vo.CasesPageReqVO;
import com.empire.module.member.dal.dataobject.cases.CasesDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 案件管理 Mapper
 *
 * @author 主席大人
 */
@Mapper
public interface CasesMapper extends BaseMapperX<CasesDO> {

    default PageResult<CasesDO> selectPage(CasesPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CasesDO>()
                .likeIfPresent(CasesDO::getCaseName, reqVO.getCaseName())
                .eqIfPresent(CasesDO::getDescription, reqVO.getDescription())
                .eqIfPresent(CasesDO::getDelFlag, reqVO.getDelFlag())
                .eqIfPresent(CasesDO::getCreateBy, reqVO.getCreateBy())
                .betweenIfPresent(CasesDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(CasesDO::getUpdateBy, reqVO.getUpdateBy())
                .orderByDesc(CasesDO::getId));
    }

}